package biz.microplus.information.bean;

import java.math.BigDecimal;
import java.util.List;

import biz.microplus.information.common.DateUtil;
import biz.microplus.information.dao.AuctionBidDAO;
import biz.microplus.information.service.AuctionBidService;
import biz.microplus.information.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * 结算账户交易记录数据模型
 */
@Entity
public class AccountTradeBean extends BaseBean {

    public static final String ACCOUNT_TRADE_METHOD_INCOME = "1";
    public static final String ACCOUNT_TRADE_METHOD_EXPEND = "2";

    public AccountTradeBean(){}

    public AccountTradeBean(AccountBean account, String method, BigDecimal amount){
        this.setAmount(amount);
        this.setMethod(method);
        this.setBalance(account.getBalance());
        this.setAccountId(account.getId());
        this.setParentId(account.getParentId());
        this.setCreatedAt(DateUtil.getNowTimestamp());
    }

    /**
     * 标识ID
     */
    @Id
    private int id;
    /**
     * 账户ID
     */
    private int parentId;
    /**
     * 结算账户ID
     */
    private int accountId;
    /**
     * 操作人ID
     */
    private int userId;
    /**
     * 交易金额
     */
    private BigDecimal amount;
    /**
     * 账户结余
     */
    private BigDecimal balance;
    /**
     * 交易类型
     */
    private String method;
    /**
     * 交易描述
     */
    private String summary;
    /**
     * 删除时间戳
     */
    private int deletedAt;
    /**
     * 创建时间戳
     */
    private int createdAt;
    /**
     * 更新时间戳
     */
    private int updatedAt;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getParentId() {
        return parentId;
    }

    public void setParentId(int parentId) {
        this.parentId = parentId;
    }

    public int getAccountId() {
        return accountId;
    }

    public void setAccountId(int accountId) {
        this.accountId = accountId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public int getDeletedAt() {
        return deletedAt;
    }

    public void setDeletedAt(int deletedAt) {
        this.deletedAt = deletedAt;
    }

    public int getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(int createdAt) {
        this.createdAt = createdAt;
    }

    public int getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(int updatedAt) {
        this.updatedAt = updatedAt;
    }

}
